package zozopo.business;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.SessionAware;

import zozopo.background.operator.operations.OperatorOS;
import zozopo.background.operator.operations.OperatorTB;
import zozopo.operations.business.IPReportOS;
import zozopo.user.operations.UserOS;
import zozopo.user.operations.UserTB;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class DeleteIpReportAction extends ActionSupport implements Action,SessionAware{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HttpServletRequest request;
	HttpServletResponse response;
	private Map<Object, Object> session;
	
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		request = arg0;
	}

	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		response = arg0;
	}
	public void setSession(Map arg0) {
		// TODO Auto-generated method stub
		session = arg0;
	}
	
	
	public String execute(){
		
UserTB user = (UserTB) session.get("userInfo"); 
		
	//权限处理
	OperatorTB operator = (OperatorTB)session.get("operatorInfo"); 

		if(!OperatorOS.operatorFlagLeve(operator, 5, 1)){
			return NONE;
		}
		
		IPReportOS ipReportOS = new IPReportOS();
		
		if(ipReportOS.deleteAllRecord()){
			return SUCCESS;
		}else{
			return ERROR;
		}
		
		
	}
}
